package com.shrct.businessprocess.organization.impl;

import com.shrct.businessprocess.organization.RCSupplier;
import com.shrct.businessprocess.organization.RCSupplierDAO;
import edu.fudan.mylang.pf.BaseDAOService;
import edu.fudan.mylang.pf.IGenericQuery;
import java.util.Collection;
import org.eclipse.xtext.xbase.lib.IterableExtensions;
import org.springframework.stereotype.Service;

@Service("com.shrct.businessprocess.organization.RCSupplierDAO")
public class RCSupplierDAOImpl extends BaseDAOService<RCSupplier> implements RCSupplierDAO {
  public RCSupplier findByExactName(final String name) {
    IGenericQuery<RCSupplier> query=getObjectFactory().createGenericQuery(RCSupplier.class,"select e from com.shrct.businessprocess.organization.impl.RCSupplierImpl as e   where ((e.name) = (:name)) and  e.active = 1      ").setParameter("name",name);
    Collection<RCSupplier> _list = query.list();
    RCSupplier _head = IterableExtensions.<RCSupplier>head(_list);
    return _head;
  }
  
  public RCSupplier findByExactCode(final String code) {
    IGenericQuery<RCSupplier> query=getObjectFactory().createGenericQuery(RCSupplier.class,"select e from com.shrct.businessprocess.organization.impl.RCSupplierImpl as e   where ((e.code) = (:code)) and  e.active = 1      ").setParameter("code",code);
    Collection<RCSupplier> _list = query.list();
    RCSupplier _head = IterableExtensions.<RCSupplier>head(_list);
    return _head;
  }
}
